package com.haochen.gatewaySentinel;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
public class GatewaySentinelApplication {

    @RestController
    public class TestController {

        @SentinelResource(value = "hello", fallback = "fallbackA")
        @GetMapping(value = "/hello")
        public String hello() {
            System.out.println("Hello Sentinel");
            return "Hello Sentinel";
        }

        @GetMapping(value = "/fallbackA")
        public String fallbackA() {
            return "不好意思哦～";
        }

    }
}
